<div id="modals">

    <!--modals-->
</div>
<div class="row">
    <div class="top-handle-btn">
        <!--search-form-->

        <button type="button" class="btn dark purple btn-add radius6"><i class="fa fa-plus"></i> 编辑模板</button>
        <span class="required-star">  * 本配送方案仅适用于保税商品及直邮商品</span>
    </div>
</div>
<div class="row">

    <!--main-content-->
    <table id="data-table" class="table table-striped table-bordered table-hover" width="100%">
        <thead>
        <tr>
            <th>发货地点</th>
            <th>配送地区</th>
            <th>首重</th>
            <th>起步价</th>
            <th>续重</th>
            <th>续费</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
        <tfoot>
        </tfoot>
    </table>
</div>

<!--table-data-loader-->
<script type="text/javascript">
    var resourceUrl = "/freight";

    sessionStorage.removeItem("editFreightByHouseId");


    function toEdit(id) {
        sessionStorage.setItem("editFreightByHouseId", id);
        loadHtml("/shipping/freight-edit");
    }


    $(function () {


        $(".btn-add").on("click", function () {
            loadHtml("/shipping/freight-edit");
        });

        DataTable.init({
            url: resourceUrl, //ajax请求url
            tableName: "data-table", //数据表table id
            paramsFormName: "search-form", //查询参数form id
            modal: "modals", //模态框div
            columns: [ //列对应的字段数组，注意顺序
                {data: "houseType", visible: false},
                {data: "houseId", visible: false},
                {
                    data: "houseName"
                },
                {
                    data: "addressDesc"
                },
                {
                    data: "firstWeight",
                },
                {
                    data: "firstFee",
                },
                {
                    data: "renewWeight",
                },
                {
                    data: "renewFee",
                },

            ],
            options: [ //操作区域(id)
                {
                    icon: "fa fa-edit",
                    name: "编辑",
                    pre:"toEdit"
                },
                {
                    icon: "fa fa-remove",
                    name: "删除",
                    del: resourceUrl,
                },
            ],
        });
    });

</script>